package com.laicunba.service.impl;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.laicunba.service.FinancingTargetBidHistoryService;
import com.laicunba.util.AssertUtil;

@Service
public class FinancingTargetBidHistoryServiceImpl extends BaseServiceImpl implements FinancingTargetBidHistoryService {
	private static final Logger LOG = Logger.getLogger(FinancingTargetBidHistoryServiceImpl.class);

	@Transactional
	@Override
	public int moveNotPaiedToHistory() {
		int copyEffectRows = updateDao.insert("FINANCING_TARGET_BID_HISTORY.copyNotPaiedToHistory", null);
		int delEffectRows = updateDao.delete("FINANCING_TARGET_BID_HISTORY.deleteNotPaiedBid", null);
		LOG.info(String.format("将未支付的投标数据移动到历史记录表中, copyEffectRows=%s, delEffectRows=%s 。", copyEffectRows, delEffectRows));
		AssertUtil.assertTrue(copyEffectRows == delEffectRows, "COPY_DEL_ROWS_NOT_MATCH");
		return copyEffectRows;
	}

	@Override
	public int moveExpiredActivityToHistory() {
		// TODO Auto-generated method stub
		return 0;
	}

}
